package com.atguigui.leetcode1;

/**
 * Project: leetcode
 * Package: com.atguigui.leetcode1
 * Version: 1.0
 * <p>
 * Created by WJX on 2023/8/7 9:52
 */
public class P6925FaultyKeyboard {
    public static void main(String[] args) {
        Solution solution = new P6925FaultyKeyboard().new Solution();
        // TO TEST
    }

    class Solution {
        public String finalString(String s) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                if ("i".equals(s.substring(i, i + 1))) {
                    // 反转
                    sb.reverse();
                } else {
                    sb.append(s.substring(i, i + 1));
                }
            }
            return sb.toString();
        }
    }
}
